/*
 * Tester.h
 *
 *  Created on: 19/mag/2013
 *      Author: Ialenti Andrea, Marangon Fabio
 */

#ifndef TESTER_H_
#define TESTER_H_

#include "StatusCodes.h"
#include "Types.h"

//	Function used to parse command line parameters.
void parseCommandLine(const Config *cfg, int argc, char **argv, bool *verbosity, char *fileName, bool *nodePerm, bool *use3Opt, bool *useProxSrch, bool *useCPLEX, bool *useCB);

//	Function used to import a TSP-Lib problem into a graph.
Status importProblem(const Config *cfg, char *fileName, Graph *g, bool verbose, bool nodePerm);

//	Calculates problem lower and upper bounds, and remove some graph edges.
Status simplifyProblem(const Config *cfg, Graph *g, double *LB, double *UB, OneTree *lagrTree, OneTree *heuTour, bool use3Opt, bool *lagrOpt, bool verbose);

//	Function used to create the initial Proximity Search problem.
Status createProxySearchProblem(const Config *cfg, CPXENVptr *env, CPXLPptr *psLP, CPXLPptr *lp, Problem *p, Problem *psP, Graph *g, double LB, double UB, OneTree *tour, bool verbose);

//	Function used to create the initial problem, without SECs.
Status createCPLEXProblem(const Config *cfg, CPXENVptr *env, CPXLPptr *lp, Problem *p, Graph *g, double LB, double UB, bool verbose, bool useCB);

//	Function used to solve the TSP problem using the CPLEX callbacks to add SECs.
Status solveTSP_CB(const Config *cfg, CPXENVptr *env, CPXLPptr *lp, Problem *p, Graph *g, cbData *data, bool verbose);

//	Function used to find the first solution.
Status solveUsingMiliotis(const Config *cfg, CPXENVptr *env, CPXLPptr *lp, Problem *p, Graph *g, bool verbose);

//	Function used to run our branch and bound algorithm.
Status runBranchAndBound(const Config *cfg, Graph *g, double *UB, bool verbose);

//	Function used to free the memory before terminating the program.
Status releaseMemory(const Config *cfg, CPXENVptr *env, CPXLPptr *lp, Problem *p, Graph *g, bool lagrOpt, bool ps, CPXLPptr *psLP, Problem *psP);

#endif /* TESTER_H_ */
